/*
 * ChangeColor.java
 *
 * Created on 1 maggio 2007, 12.49
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package alecava;

import java.awt.Color;
import java.util.Random;
import java.util.TimerTask;
import javax.swing.JTable;

/**
 *
 * @author alecava
 */
public class ChangeColor extends TimerTask {
    private JTable t;
    private float colore = 0;
    private boolean inc = true;
    /** Creates a new instance of ChangeColor */
    public ChangeColor(JTable t) {
        this.t = t;
    }
    
    public void run(){
        
        if (inc){
            colore += 0.02F;
            if (colore > 1.0F){
                colore = 1.0F;
                inc = false;
            }
        } else {
            colore -= 0.02F;
            if (colore < 0.0F){
                colore = 0.0F;
                inc = true;
            }
        }
        
        t.setGridColor(new Color(0.5F, colore, 1.0F));
    }
    
}
